<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" autoFlush="true"%>
<%@include file="/common/taglib.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<x:multiLanguage>
<HEAD>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link href="../css/dialog.css" rel="stylesheet" type="text/css" />
<link href="../css/ddtabmenu_dialog.css" rel="stylesheet" type="text/css" />

<script src="common/fck_dialog_common.js" type="text/javascript"></script>
<script language="JavaScript" src="dialog.js"></script>
<script language="JavaScript" src="script.js"></script>
<script language="JavaScript" src="sequence.js"></script>

<script language="JavaScript" src='<s:url value="/script/jquery/jquery-1.4.2.js" />'></script>
<script language="JavaScript" src='<s:url value="/script/ddtabmenufiles/ddtabmenu.js" />'></script>

<SCRIPT language="JavaScript">
var dialog	= window.parent ;
var oEditor = dialog.InnerDialogLoaded() ;
// Gets the document DOM
var oDOM = oEditor.FCK.EditorDocument ;
var oActiveEl = dialog.Selection.GetSelectedElement() ;


function Ok() {
	if(ev_check()){
		oEditor.FCKUndo.SaveUndoStep() ;
		//var id=getFieldId();
		createRelStr(); // 保存值到processDescription
		
		var json = getFormJSON(); // 查看dialog.js
		json['className'] = "cn.myapps.core.dynaform.form.ejb.TextareaField";
		oActiveEl = CreateNamedElement(oEditor, oActiveEl, 'TEXTAREA', json);		
		return true;
	}
}

//检查内容是否完成正确
function ev_check(){
   if(temp.name.value==''){
 	 alert("{*[page.name.notexist]*}");
	  return false;
   }
   return !checkStartChar(temp.name.value);
}

function checkStartChar(value){
	return IsDigit(value,"{*[page.name.startingit]*}");
}

function ev_onTextTypeChanged(value){
	//文本类型如果为只读是,显示“只显示文本”选项组
	if(value == 'readonly'){
		$('#nbr').show();
	} else {
		$('#nbr').hidden();
	}
	//文本类型如果为隐藏时,则隐藏脚本选项卡无效，不可操作
	if(value == 'hidden'){
		$('#hiddenValue').val("");
		$('#hiddenScript').attr("disabled", "disabled");
		$('#hiddenScriptEditor').disabled = "disabled";
		$('#hiddenValue').disabled = "disabled";
	} else {
		$('#hiddenScript').disabled = "";
		$('#hiddenScriptEditor').disabled = "";
		$('#hiddenValue').disabled = "";
	}
}

function ev_onTyepch() {
	$('#npTD').hide();
	$('#noneTD').hide();
	$('#npDiv').hide();
    if (document.getElementsByName('fieldType').value == 'VALUE_TYPE_NUMBER'){
    	$('#npTD').show();
    	$('#npDiv').show();
 	} else {
 		$('#noneTD').show();
 	}
}

//初始值
function InitDocument(){
	oEditor.FCKLanguageManager.TranslatePage(document) ;
	
	if ( oActiveEl && (oActiveEl.tagName == 'TEXTAREA')) {
		setFormByObject(oActiveEl); // 查看dialog.js
		var items = HTMLDencode(oActiveEl.processDescription);
	    parseRelStr(items);
	}

	ev_onTyepch();
	//initForm();
	modeChange($("input[name=editMode]:checked").val());
	SelectField( 'name' ); // 选中字段
}

$(function() {
	oEditor.FCKLanguageManager.TranslatePage(document) ;
	if ( oActiveEl && (oActiveEl.tagName == 'TEXTAREA')) {
		setFormByObject(oActiveEl); // 查看dialog.js
		var items = HTMLDencode(oActiveEl.processDescription);
	    parseRelStr(items);
	}

	ddtabmenu.definemenu("tabs", "t1");
	ev_onTyepch();
	//initForm();
	modeChange($("input[name=editMode]:checked").val());
	SelectField( 'name' ); // 选中字段

	dialog.SetOkButton( true ) ;
	dialog.SetAutoSize( true ) ;
});
</script>
	</HEAD>
	<BODY >
	<form name="temp">
	<div id="tabs" class="basictab">
			<ul>
			<li><a id="t1" rel="tabs-1">Basic</a></li>
			<li><a id="t2" rel="tabs-2">Value_Script</a></li>
			<li><a id="t3" rel="tabs-3">Validate_Script</a></li>
			<li><a id="t4" rel="tabs-4">Hidden_Script</a></li>
			<li><a id="t5" rel="tabs-5">Hidden_Print_Script</a></li>
			<li><a id="t6" rel="tabs-6">ReadOnly_Script</a></li>
		</ul>
		</div>
		
		<div id="contents">
			<div id="tabs-1">
				<table border=1 cellpadding=3 cellspacing=1 class="content"  id="content1"  width="520px">
					<tr>
						<td class="commFont commLabel">Name :</td>
						<td colspan="3"><input type=text name="name" id="name" class="store" ></td>
					</tr>
					<tr>
						<td class="commFont commLabel"><font color="red">(Readonly )</font>Only Show Text :
						</td>
						<td colspan="3"><input type="radio" name="borderType" class="store" value="false" checked>No &nbsp; 
							<input type="radio" class="store" name="borderType" value="true">Yes </td>
					</tr>
					<tr>
						<td colspan="4" align="center"><input type=checkbox class="store" name="refreshOnChanged" value="true">Refresh &nbsp; 
							<input class="store" type=checkbox name="calculateOnRefresh" value="true">Recalculate &nbsp;
						<input type=checkbox name="mobile" value="true" checked  class="store"/>Mobile &nbsp;
						</td>
					</tr>
					<tr>
						<td class="commFont commLabel">Description :</td>
						<td colspan="3"><textarea name="discript"  class="store" style="width: 100%;"rows="7"></textarea>
						</td>
					</tr>
				</table>
			</div>
			<div id="tabs-2">
				<table border="1" cellpadding="3" cellspacing="1" class="content" id="content2" width="520px">
					<%@include file="commondialog.jsp"%>
				</table>
			</div>
			<div id="tabs-3">
				<table border=1 cellpadding=3 cellspacing=1 class="content"
					id="content3"  width="520px" >
					<tr>
	
						<td width="75%"><textarea name="validateRule" class="store" style="width: 95%" rows="10"></textarea>
						</td>
					</tr>
				</table>
			</div>
		   <div id="tabs-4">
				<table border=1 cellpadding=3 cellspacing=1 class="content"
					id="content4">
					<tr>
						<td><textarea  class="store" name="hiddenScript" style="width: 96%" rows="10"></textarea>
					</tr>
					<tr>
						<td>hiddenValue ：<input  class="store" type="text" name="hiddenValue" /></td>
					</tr>
					</table>
			</div>
			<div id="tabs-5">
				<table border=1 cellpadding=3 cellspacing=1 class="content"
					id="content5"  width="520px">
					<tr>
						<td><textarea name="hiddenPrintScript" style="width: 96%" rows="10" class="store"></textarea>
						</td>
					</tr>
					<tr>
						<td>Print hiddenValue ：<input type="text" class="store" name="printHiddenValue" /></td>
					</tr>
				</table>
			</div>
			<div id="tabs-6">
				<table border=1 cellpadding=3 cellspacing=1 class="content"
					id="content6">
					<tr>
						<td><textarea name="readonlyScript" style="width: 96%" class="store" rows="10"  width="520px"></textarea>
						</td>
					</tr>
				</table>
			</div>
		</div>
	</form>
	</BODY>
</x:multiLanguage>
</HTML>
